package com.igeek;

import javax.servlet.*;
import java.io.IOException;

public class MyFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("过滤器初始化");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("过滤方法");
        //应用退出，销毁过滤器
        System.exit(0);
    }

    @Override
    public void destroy() {
        System.out.println("过滤器销毁方法");
    }
}
